package com.tencent.sr.iris.activity.restapi.activity;

import com.tencent.sr.iris.activity.interfaces.client.activity.UserEventReportClient;
import com.tencent.sr.iris.activity.interfaces.request.acticity.UserOpenAppRequest;
import com.tencent.sr.iris.activity.service.activity.UserEventReportService;
import com.tencent.sr.rmall.common.primitive.HttpResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import javax.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author xiaojun
 */
@Slf4j
@Api(tags = "活动-用户事件上报接口", value = "活动-用户事件上报接口")
@RestController
@RequestMapping("/api/v1/iris/iris-activity-core-service/task/user/event")
public class UserEventReportController implements UserEventReportClient {

    @Resource
    private UserEventReportService userEventReportService;

    @Override
    @PostMapping("userOpenApp")
    @ApiOperation("用户打开小程序事件上报")
    public HttpResult<Boolean> userOpenApp(@Validated @RequestBody UserOpenAppRequest request) {
        Boolean result = userEventReportService.userOpenApp(request);
        return HttpResult.succ(result);
    }
}
